<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<div style="width:300px;height:200px"><div></div></div>
<div><table><thead><tr>
    <td>ads</td>
<td>ads</td>
<td>ads</td>
<td>ads</td>
<td>ads</td>
</tr></thead>
</table></div>

<body>
    <script type="text/javascript">
        function createData(callback) {
            callback(999);
        }
        var obj = {
            data: 100,
            tool: function () {
                var self = this;   //这里的this指向obj，然后当一个变量取用 function(){} 相当于给了let a=createData()函数的a 
                createData(function (n) {
                    self.data = n;
                })
            }
        }
        obj.tool();
        console.log(obj.data);
    </script>
</body>

</html>